<?php

class Customers extends CI_Controller {
  
    private $_auth;

    public function __construct() {
        parent::__construct();
        $this->_auth = $this->myclass->checkuser();
        if ($this->_auth == FALSE)
            redirect("backend/home");
    }

    public function index() {
        $config['first_link']='Đầu';
        $config['last_link'] = 'Cuối';
        $config['cur_tag_open'] = "<a class='selected'>";
        $config['cur_tag_close'] = "</a>";
        $config['full_tag_open'] = "<div class='paging'>";
        $config['full_tag_close'] = '</div';
        
        $this->load->library('pagination');
        $config['uri_segment'] = 4;
        $config['base_url'] = base_url() . 'backend/customers/index';
        $config['total_rows'] = count($this->mcustomers->fetchAll());
        $config['per_page'] = 9;
        $this->pagination->initialize($config);
        $data['data']['listpro'] = $this->mcustomers->fetchAll($config['per_page'], $this->uri->segment(4));
        $data['data']['paging'] = $this->pagination->create_links();

        $data['title'] = "Bảng thành viên";
        $data['temp'] = "backend/customers/home";
        $this->load->view("backend/layout/index", $data);
    }
  

    public function delete($id) {
        $this->mcustomers->delete($id);
        redirect("backend/customers");
    }

   
  
}
